﻿using System;
using QD.Framework.MVC;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace QD.Web.Management.Models.@(Model.ControllerName)
{
    public class @(Model.DomainModelName)
    {

		@foreach(var col in Model.Columns)
		{
			if(!col.inview){
				if(col.desc != ""){
				/// <summary>
				/// @col.desc
				/// </summary>
				}
			}
			if(col.iskey){
				@:[Key]
			}
			if(col.identity){
				@:[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
			}
			if(!col.allownull){
				@:[Required]
			}
			if(col.clrtype == "string" && col.length != -1)
			{
				if(col.type == "nvarchar"){
					var l = col.length/2;
					@:[StringLength(@(l))]
				}else{
					@:[CharacterLength(@(col.length))]
				}
			}
			if(!string.IsNullOrEmpty(col.desc)){
				@:[Display(Name="@(col.desc)")]
			}else{
				@:[Display(Name="@(col.name)")]
			}
			@("public "+(col.clrtype)+" "+(col.name)+"{ get; set; }")


			}
		}
	}